﻿/**
 *
 * resource.h
 *
 *  Created on: 2019-12-06
 *      Author: chenshisheng
 */

#ifndef RESOURCE_H_
#define RESOURCE_H_

#include "main.h"
#include "at_command.h"
#include "message_queue.h"

typedef enum
{
    Resource_TotalWeight,
    Resource_InputWeight,
    Resource_IsDoorOpened,
    Resource_OpenDoor,
    Resource_IsFull,
    Resource_IsSensorFail,
    Resource_Battery,
    Resource_Time,

    Resource_Max
}Resource_t;

typedef struct
{
    int objId;
    int insId;
    int resId;
}Resource_Path_t;

void Resource_Init(void);
int Resource_MiplCreate(void);
int Resource_AddObj(void);
int Resource_DiscoverRsp(void);
int Resource_Update(Resource_t res, AtCommand_DataType_t type, AtCommand_Value_t value);
bool Resource_IsNeedNotify(void);
int Resource_NotifyAll(void);
void Resource_OnMiplDiscoverObj(const MsgQueue_Msg_t* msg);
AtCommand_WriteResult_t Resource_OnWrite(const AtCommand_WriteInfo_t *info);
int Resource_NotifyCmd(Stream_t *stream, int argc, char *argv[]);
void Resource_OnHeartbeat(const MsgQueue_Msg_t *msg);

#endif /* RESOURCE_H_ */
